<?php
	require "akses.php";
	if (!isset($_SESSION)) {session_start();}
	connect();
	function saveFile($uname) {
		if ($_FILES["input_avatar"]["error"] > 0) {
			echo "Return Code: " . $_FILES["myImage"]["error"] . "<br />";
		} else {
			$avatarfolder = "images/avatar/";
			$savefilename = $uname."."."jpg";
			move_uploaded_file($_FILES["input_avatar"]["tmp_name"],
			$avatarfolder . $savefilename);
			echo $avatarfolder . $savefilename;
		}
	}
	
	saveFile($_SESSION['username']);
?>